package com.jxnu.duewang.zmly.zouZhen.adapter;

import androidx.databinding.BindingAdapter;

import android.widget.ImageView;

import com.jxnu.duewang.zmly.R;
import com.squareup.picasso.Picasso;

/**
 * Project Zmly
 * Author Duewang
 * Time 2016/12/6 0006
 */

public class FocusBindingAdapter {
    @BindingAdapter("loadFocusImgUrl")
    public static void loadImage(ImageView view, String url){
        if (url != null) {
            Picasso.with(view.getContext()).load(url).placeholder(R.mipmap.image_default_200).error(R.mipmap.image_default_200).into(view);
        }
//        else {
//            view.setImageResource(R.mipmap.image_default_200);
//        }
    }

    @BindingAdapter("loadSpecialImgUrl")
    public static void loadOtherImage(ImageView view, String url){
        if (url != null) {
            Picasso.with(view.getContext()).load(url).resize(145,145).placeholder(R.mipmap.image_default_145).error(R.mipmap.image_default_145).into(view);
        }
    }

}
